<%@ taglib uri="http://www.springframework.org/tags" prefix="s"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="sf"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
<%@ include file="html-header.jsp"%>
<style type="text/css">
<%@ include file="../stylesheets/main.css"%>
<%@ include file="../stylesheets/header.css"%>
<%@ include file="../stylesheets/footer.css"%>
<%@ include file="../stylesheets/adminContent.css"%>
<%@ include file="../stylesheets/carousel.css"%>
</style>
</head>
<body>
	<div id="left-column-outer">
		<div id="left-column"></div>
	</div>

	<div id="center-column">
		<div class="CenteredContainer">
			<img id="background_noresize" alt="background_noresize"
				src="/Browarex/img/background.jpg">
			<%@ include file="header.jsp"%>
			<div class="ContentShade"></div>
			<div class="ContentContainer">
				<table style="padding: 20;">
					<tbody>
						<c:forEach items="${productsList}" var="product">
							<tr>
								<td><c:choose>
										<c:when test="${product.image !=null}">
											<sf:form method="post" modelAttribute="product"
												action="deletePhoto" style="margin-bottom: 0px;">
												<img src="getImage?imageId=${product.id}" class="BeerImage" />
												<sf:hidden path="id" value="${product.id}" />
												
												<span style="font-weight: bolder; font-size:x-large;">${product.productName}</span>
													<span>${product.voltage}%, ${product.capacity}l</span>
												<br />
												<span><s:message code="product.type" />${product.type}</span>
												<br />
												<span><s:message code="product.packageType" />${product.packageType.value}</span>
												<br />
												<span><s:message code="product.description" />${product.description}</span>
												<br/>
												
												<input type="submit"
													value="<s:message code="button.deleteImage"/>" style="float:left; padding-left: 0; margin-top:5px">
											</sf:form>
											<sf:form method="post" modelAttribute="uploadItem"
												action="photo" enctype="multipart/form-data" style="float: left;">
												<sf:hidden path="id" value="${product.id}" />
												<sf:input type="file" path="fileData" style="margin-top:5px;"></sf:input>
												<input type="submit" value="<s:message code="button.save"/>" style="margin-top:5px;"/>
											</sf:form>
										</c:when>
										<c:otherwise>
											<sf:form method="post" modelAttribute="uploadItem"
												action="photo" enctype="multipart/form-data">
												<img src="/Browarex/img/noImage.jpg" class="BeerImage" />
												<!--s:message code="product.missingImage" /-->
												<sf:hidden path="id" value="${product.id}" />												

												<span style="font-weight: bolder; font-size:x-large;">${product.productName}</span>
													<span>${product.voltage}%, ${product.capacity}l</span>
												<br />
												<span><s:message code="product.type" />${product.type}</span>
												<br />
												<span><s:message code="product.packageType" />${product.packageType.value}</span>
												<br />
												<span><s:message code="product.description" />${product.description}</span>
												<br/>
												<sf:input type="file" path="fileData" style="margin-top:10px;"></sf:input>
												<input type="submit" value="<s:message code="button.save"/>" style="margin-top:10px;"/>
											</sf:form>
										</c:otherwise>
									</c:choose></td>
							</tr>
						</c:forEach>
					</tbody>
				</table>
			</div>
			<%@ include file="footer.jsp"%>
		</div>
	</div>

	<div id="right-column-outer">
		<div id="right-column"></div>
	</div>
</body>
</html>